package com.neuedu.studentmanage.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neuedu.studentmanage.entity.Report;
import com.neuedu.studentmanage.entity.Pager;
import com.neuedu.studentmanage.entity.Result;
import com.neuedu.studentmanage.mapper.ReportMapper;
import com.neuedu.studentmanage.service.ReportService;
@Service
public class ReportServiceImpl implements ReportService{
	@Autowired
	private ReportMapper reportMapper;
	private Logger logger=Logger.getLogger(ReportServiceImpl.class);
	@Override
	public List<Report> findListByPager(Pager<Report> pager) {
		
		return reportMapper.findListByPager(pager);
	}

	@Override
	public Integer findTotalByPager(Pager<Report> pager) {
		logger.info("findListByPager"+pager);
		return reportMapper.findTotalByPager(pager);
	}

	@Override
	public Result add(Report object) {
		Result result=new Result(false, "请假条新增失败！");
		boolean ret=reportMapper.add(object);
		if (ret) {
			result=new Result(true, "请假条新增成功！");
		}
		return result;
	}

	@Override
	public Result edit(Report object) {
		Result result=new Result(false, "假条信息修改失败！");
		boolean ret=reportMapper.edit(object);
		if (ret) {
			result=new Result(true, "假条信息修改成功！");
		}
		
		return result;
	}

	@Override
	public Result deleteByIds(List<Report> ids) {
		Result result=new Result(false, "假条删除失败！");
		boolean ret=reportMapper.deleteByIds(ids);
		if (ret) {
			result=new Result(true, "假条删除成功！");
		}
		return result;
	}

	@Override
	public List<Report> findAll() {
		
		return reportMapper.findAll();
	}

}
